{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="user_auth" id="user_auth" lay-search="" class="layui-input">
                                <option  value="">全部会员等级</option>
                                <option  value="2">季度会员</option>
                                <option  value="3">半年会员</option>
                                <option  value="4">一年会员</option>
                            </select>
                        </div>

                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="user_username" class="layui-input search" name="user_username" value="" placeholder="用户名称"/>
                        </div>

                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button class="btn btn-primary" type="button" onclick="wk.href('{:url('addMember')}');">
                            <i class="fa fa-plus"></i> 开通会员
                        </button>
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>

                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.user_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                    </script>

                    <!--类型模板-->
                    <script type="text/html" id="typeTpl">
                        {{# if(d.user_auth == 2){ }}
                        季度会员
                        {{# }else if(d.user_auth == 3){ }}
                        半年会员
                        {{# }else if(d.user_auth == 4){ }}
                        一年会员
                        {{# } }}
                    </script>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Membership/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type:'numbers', width: 80, title: '序号'}
                , {field: 'user_id', width: 80, title: '用户ID', align: 'center'}
                , {field: 'user_username', width: 120, title: '用户名称', align: 'center'}
                , {field: 'user_image', width: '', title: '头像', align: 'center', templet: '#imgTpl'}
                , {field: 'order_type', width: 100, title: '类型', align: 'center', templet:'#typeTpl'}
                , {field: 'user_auth_start', width: '', title: '购买时间', align: 'center'}
                , {field: 'user_auth_end', width: '', title: '结束时间', align: 'center'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
    });
</script>
</body>
</html>